<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>人和人律师事务所管理系统v1.0-个人密码修改</title>

	<script type="text/javascript">

		var modifyPwdWin;
		Ext.onReady(function()
		{
		var pwdFormPanel=new Ext.FormPanel(
				{
					labelAlign:'right',
					buttonAlign:'center',
					frame:true,
					width:300,
					height:160,
			        labelWidth:100,
			        layout: 'form',

			        items:
			        [

			        {
			            xtype : 'hidden',
			            name: 'userId',
			            value:<%=session.getAttribute("userId")%>,
			         },
			         {
				        xtype : 'hidden',
				        name: 'role',
				        value:<%=session.getAttribute("role")%>,
			         },

			         {
			        	xtype : 'textfield',
			        	inputType:'password',
			            fieldLabel: '旧密码',
			            name: 'old_pwd',
			            id: 'old_pwd',
			            allowBlank :false
			         },
			         {
			         	xtype : 'textfield',
			         	inputType:'password',
			          	fieldLabel: '新密码',
			          	name: 'new_pwd',
			          	id: 'new_pwd',
			         	allowBlank :false
			         },
			         {
			         	xtype : 'textfield',
			         	inputType:'password',
			         	fieldLabel: '确认新密码',
			          	name: 'confirm_new_pwd',
			          	id: 'confirm_new_pwd',
			          	allowBlank :false
			         }
			        ],
			         buttons : [ {
			            text : '确认',
			            iconCls:'confirm',
			            disabled : false,
			            handler : function() {
			            //获取判断两次输入的密码是否相同
			            var newpwd1=Ext.getCmp("new_pwd").getValue();
			            var newpwd2=Ext.getCmp("confirm_new_pwd").getValue();
			            //如果两次输入的密码相同
			            if(newpwd1!=newpwd2){
			             Ext.MessageBox.alert('提示', '两次输入的密码不相同');
			             return;
			            }
			                if (pwdFormPanel.form.isValid()) {
			                    pwdFormPanel.form.submit( {
			                        url : 'ModifyPersonalPwd.jsj',
			                        success : function(from, action) {
			                         Ext.MessageBox.alert('修改结果', action.result.message);
			                            modifyPwdWin.hide();
			                        },
			                        failure : function(form, action) {
			                           Ext.MessageBox.alert('修改结果', action.result.message);
			                            modifyPwdWin.hide();
			                        },
			                        waitMsg : '正在保存数据，稍后...'
			                    });
			                } else {
			                    Ext.Msg.alert('信息', '请填写完成再提交!');
			                }
			            }
			        }, {
			            text : '取消',
			            iconCls:'cancel',
			            handler : function() {
			                modifyPwdWin.hide();
			            }
			        }]
			        });

			modifyPwdWin=new Ext.Window(
			{
				title:"修改密码",
				resizable:false,
				items:pwdFormPanel
			});

			modifyPwdWin.show();
		});

	</script>
	</head>
	<body>

	</body>
</html>